package com.jdls.day16.work;

/**
 * @author 嘉德罗斯
 * @date 2021/8/7
 */
public class Test2 {
    public static void main(String[] args) {
        //2. 死锁实现
        Object a = new Object();
        Object b = new Object();
        new Thread(()->{
            while (true) {
                synchronized (a){
                    synchronized (b){
                        System.out.println("执行");
                    }
                }
            }
        }).start();
        new Thread(()->{
            while (true) {
                synchronized (b){
                    synchronized (a){
                    }
                }
            }
        }).start();
    }
}
